// Copyright (c) 2012 Rene Bolldorf <rb@radix.io>
// Use of this source is governed by the GNU General Public License version 3,
// the license can be found in the LICENSE file.

var storage = {};

storage.saveUserInfo = function (obj) {
  var cur = this.loadUserInfo();

  for (var i=0; i < obj.length; i++) {
    if (!cur[i])
      cur.push([]);
    if (cur[i].indexOf(obj[i]) == -1)
      cur[i].push(obj[i]);
  }

  window.localStorage.setItem('userinfos', JSON.stringify(cur));
};

storage.loadUserInfo = function () {
  return JSON.parse(window.localStorage.getItem('userinfos')) || [];
};
